<template>
  <div>I am Kunzai<br/>
    <el-select
      v-model="search.platformNameId"
      placeholder="请选择平台"
      filterable
      clearable
      collapse-tags>
      <el-option
        v-for="item in platformList"
        :key="item.platformId"
        :label="item.platformName"
        :value="item.platformId">
      </el-option>
    </el-select>
    <el-select
      v-model="search.platformNameId1"
      placeholder="请选择平台1"
      filterable
      clearable
      collapse-tags>
      <el-option
        v-for="item in platformList"
        :key="item.platformId"
        :label="item.platformName"
        :value="item.platformId">
      </el-option>
    </el-select>
  </div>
</template>

<script>
  import {getPlatfromList} from '@/api';

  export default {
    name: "kunzai",
    data() {
      return {
        platformList: [{
          platformId: 1,
          platformName: "kunzai"
        },
          {
            platformId: 2,
            platformName: "huzai"
          }],
        search: {
          platformNameId: 2,
          platformNameId1: 1
        }
      }
    },
    /*执行的操作*/
    created() {
      this.getSelectList();
    },
    /*定义方法的地方*/
    methods: {
      /*当执行调接口时传参数,getPlatfromList(params).then(({data}) => {});*/
      /*自定义的方法*/
      getSelectList() {
        /*调用上面import的方法,并执行调接口,调用接口进行获取数据*/
        getPlatfromList().then(({data}) => {
          this.platformList = data.platformList;
          this.search.platformNameId = data.platformList[0].platformId;
        })
      }
    }
  }

  /*export default {
    name: "kunzai",
    data() {
      return {
        platformList: [{
          platformId: 1,
          platformName: "kunzai"
        },
          {
            platformId: 2,
            platformName: "huzai"
          }],
        search: {
          platformNameId: 2,
          platformNameId1: 1
        }
      }
    }
  }*/


</script>

<style scoped>

</style>
